package com.woniu.config;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Aspect
@Component
@Slf4j
public class LogAspect {

    @Around("execution(* com.woniu.apiimpl.*.*(..))")
    public Object insertLog(ProceedingJoinPoint point) throws Throwable {

        Object[] args = point.getArgs();
        String name = point.getSignature().getName();
        log.info("进入接口{}， 参数为：{}", name, args);
        Object proceed = point.proceed(args);
        log.info("{}接口执行完成，参数为：{}", name, proceed);

        return proceed;
    }}
